# 05-ATM.py
# 查余额
def get(name):
    print(f'{name},您好，您的余额为:{money}RMB')
# 存款
def up_money(name):
    a = int(input('请输入存款金额:'))
    global money # 提升
    money = money+a
    print(f'{name}，你好，您存款{a}RMB成功！')
    print(f"{name},你好，你的余额剩余{money}RMB")
# 取款
def q_money(name):
    a = int(input('请输入取款金额：'))
    global money # 提升
    if a<money:
        money = money-a
        print(f"{name}，你好，当前取款金额为{a}元")
        print(f"{name},你好，余额剩余{money}RMB")
    else:
        print('没钱还想取！')    
    
# 主菜单
money = 200
def main(name):
    print(f'{name},你好，欢迎来到农商银行ATM,请选择操作：')
    while True:
        print('查询余额[输入1]')
        print('存款\t[输入2]')
        print('取款\t[输入3]')
        print('破产\t[输入4]')
        print('退出\t[输入5]')
        index = int(input('请输入您的选择：'))
        if index==4 or index==5:break;
        if index==1:get(name)
        if index==2:up_money(name)
        if index==3:q_money(name)
main('龚*')
